package org.jeecg.chase.modules.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

/**
 * @author leikai
 * @version 1.0
 * @description:
 * @date 2022/03/05/0005 19:38
 */
@Data
@TableName("adh_coupon_info")
public class AdhCouponInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    /**
     * 优惠券类型 1:折扣券 2 现金券
     */
    private Integer couponType;
    /**
     * 优惠券名称
     */
    private String couponName;
    /**
     * 商品标题
     */
    private String commodityTitle;
    /**
     * 图片
     */
    private String picUrl;
    /**
     * 店铺Id
     */
    private String merchId;
    /**
     * 店铺名称
     */
    private String merchName;
    /**
     * 折扣或优惠金额
     */
    private BigDecimal couponDiscount;
    /**
     * 首页排序
     */
    private Integer sortNum;
    /**
     * 有效开始时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date validBeginTime;
    /**
     * 有效结束时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date validEndTime;
    /**
     * 免费领取开始时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date freeDrawBeginTime;
    /**
     * 免费领取结束时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date freeDrawEndTime;
    /**
     * 提前购买价格
     */
    private BigDecimal advancePurchasePrice;
    /**
     * 使用规则说明
     */
    private String useDesc;
    /**
     * 每人限制领取数量
     */
    private Integer useLimit;
    /**
     * 发放数量
     */
    private Integer stockNum;
    /**
     * 是否首推，1是;0否
     */
    private Boolean ifTop;
    /**
     * 状态，1未发布 2 已发布 3 已下架
     */
    private String couponStatus;
    /**
     * 创建人
     */
    private String createBy;
    /**
     * 创建日期
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 更新人
     */
    private String updateBy;
    /**
     * 更新日期
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 已领取数量
     */
    private String receiveNum;


    private String fileUrl;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        AdhCouponInfo that = (AdhCouponInfo) o;
        return Objects.equals(id, that.id) && Objects.equals(couponType, that.couponType) &&
                Objects.equals(couponName, that.couponName) && Objects.equals(commodityTitle, that.commodityTitle) &&
                Objects.equals(picUrl, that.picUrl) && Objects.equals(merchId, that.merchId) &&
                Objects.equals(merchName, that.merchName) && Objects.equals(couponDiscount, that.couponDiscount) &&
                Objects.equals(validBeginTime, that.validBeginTime) && Objects.equals(validEndTime, that.validEndTime) &&
                Objects.equals(freeDrawBeginTime, that.freeDrawBeginTime) && Objects.equals(freeDrawEndTime, that.freeDrawEndTime) &&
                Objects.equals(advancePurchasePrice, that.advancePurchasePrice) && Objects.equals(useDesc, that.useDesc) &&
                Objects.equals(useLimit, that.useLimit) && Objects.equals(stockNum, that.stockNum) && Objects.equals(ifTop, that.ifTop) &&
                Objects.equals(couponStatus, that.couponStatus) && Objects.equals(createBy, that.createBy) &&
                Objects.equals(createTime, that.createTime) && Objects.equals(updateBy, that.updateBy) && Objects.equals(updateTime, that.updateTime) &&
                Objects.equals(receiveNum, that.receiveNum);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, couponType, couponName, commodityTitle, picUrl, merchId, merchName, couponDiscount, validBeginTime, validEndTime,
                freeDrawBeginTime, freeDrawEndTime, advancePurchasePrice, useDesc, useLimit, stockNum, ifTop, couponStatus, createBy, createTime,
                updateBy, updateTime, receiveNum);
    }
}
